﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HecoItem : CombinableItem
{
    public HecoField NewSetting;
    public override ItemField ItemFieldSetting { get => NewSetting; set => NewSetting = value as HecoField; }
    public float speed
    {
        set
        {
            this.GetComponentInParent<Rigidbody2D>().rotation = value;
        }
        get
        {
            return this.GetComponentInParent<Rigidbody2D>().rotation;
        }
    }
    public override void DownloadInstanceField(object args)
    {
        base.DownloadInstanceField(args);
        var tp = (args as HecoField);
        this.speed = tp.speed;
    }
    public override ItemField UploadInstanceField()
    {
        var field= base.UploadInstanceField() as HecoField;
        field.speed = this.speed;
        return field;
    }
    public override void OnStart()
    {
        base.OnStart();
        //xxx
    }
}
[System.Serializable]
public class HecoField : CombinableItemField
{
    public float speed;
    public override void ClearWhenToBench()
    {
        base.ClearWhenToBench();
        speed = 0;
    }
}